from digits import hasUniqueDigits

digits = range(0, 10)

# first seed set with 3 digit multiples of 17
candidates = range((1 + 100/17) * 17, 1000, 17)

# only unique digits
candidates = [x for x in candidates if hasUniqueDigits(x)]

# grow list by prefixing digit
candidates = [1000 * d + x for x in candidates for d in digits]

# only unique digits
candidates = [x for x in candidates if hasUniqueDigits(x)]

# first 3 digits should be multiple of 13
candidates = [x for x in candidates if x/10 % 13 == 0]

# grow list by prefixing digit
candidates = [10000 * d + x for x in candidates for d in digits]

# only unique digits
candidates = [x for x in candidates if hasUniqueDigits(x)]

# first 3 digits should be multiple of 11
candidates = [x for x in candidates if x/100 % 11 == 0]

# grow list by prefixing digit
candidates = [100000 * d + x for x in candidates for d in digits]

# only unique digits
candidates = [x for x in candidates if hasUniqueDigits(x)]

# first 3 digits should be multiple of 7
candidates = [x for x in candidates if x/1000 % 7 == 0]

# grow list by prefixing digit
candidates = [1000000 * d + x for x in candidates for d in digits]

# only unique digits
candidates = [x for x in candidates if hasUniqueDigits(x)]

# first 3 digits should be multiple of 5
candidates = [x for x in candidates if x/10000 % 5 == 0]

# grow list by prefixing digit
candidates = [10000000 * d + x for x in candidates for d in digits]

# only unique digits
candidates = [x for x in candidates if hasUniqueDigits(x)]

# first 3 digits should be multiple of 3
candidates = [x for x in candidates if x/100000 % 3 == 0]

# grow list by prefixing digit
candidates = [100000000 * d + x for x in candidates for d in digits]

# only unique digits
candidates = [x for x in candidates if hasUniqueDigits(x)]

# first 3 digits should be multiple of 3
candidates = [x for x in candidates if x/1000000 % 2 == 0]

# grow list by prefixing digit
candidates = [1000000000 * d + x for x in candidates for d in digits]

# only unique digits
candidates = [x for x in candidates if hasUniqueDigits(x) if 10 == len(str(x))]

print candidates, sum(candidates)